package view;

import java.awt.*;

import javax.swing.JButton;
import javax.swing.border.Border;

public class RoundedButton extends JButton {
    private static final long serialVersionUID = 1L;

    private static class RoundedBorder implements Border {

        private int radius;

        RoundedBorder(int radius) {
            this.radius = radius;
        }
        public Insets getBorderInsets(Component c) {
            return new Insets(this.radius+1, this.radius+1, this.radius+2, this.radius);
        }


        public boolean isBorderOpaque() {
            return true;
        }


        public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
            g.drawRoundRect(x, y, width - 1,height - 1, radius, radius);
        }
    }

    public RoundedButton() {
        super();

        this.setBounds(51, 19, 56, 19);
        this.setBorder(new RoundedBorder(10));//10 is the radius
        this.setForeground(Color.BLUE);

    }


}
